

public class EdgeOrientationTable extends mainS{
	public int[][] eOrientTable = new int[4][2047]; //this is the move table for edge orientation. The cube is 4 integers, and edge orientation is one of them, between 0 and 2047. There are four
	// moves that change edge orientation - F, B, F', B' (0-3). the coordinate [3][452] for example, has the result of edge orientation if you preform F' on a cube with edge orientation 452.
	Cube protoTest = new Cube();
	Cube test = new Cube(); //used for the coding, don't do anything ATM.
	
	char boolConvert(boolean a){ // It just returns the boolean character of true/false
		if (a) return '1';
		else return '0';
	}
	private int binEOTurn(int initPos, int turn){ //Poorly named. This is the function that takes the two coordinates of the table and calculates the return
		String strInitPos = Integer.toBinaryString(initPos); //The EO coordinate is converted to a binary string
		int len = strInitPos.length();
		
		for (int i = 11 - len; i > 0; i--){
			strInitPos = "0" + strInitPos; // of length 11. Each bit represents if the edge is flipped or oriented. Order is reading starting with UB. DF is determined by the others, so it's
			//length 11, not 12.. This cancels parity errors and makes it simpler
		}
		if (strInitPos.length() != 11) System.out.println("Length Error in Binary String");
		
		
		switch(turn){ // Only 4 turns can affect EO
			case 0: //3,6,7,11	
			case 2:
				if (strInitPos.charAt(2) == '1') initPos -= 128; //initPos is decimal representation
				else initPos += 128; //flips the proper bit by subtracting/adding 2^n 
				if (strInitPos.charAt(5) == '1') initPos -= 16;
				else initPos += 16;
				if (strInitPos.charAt(6) == '1') initPos -= 8;
				else initPos += 8;
				//if (strInitPos.charAt(10) == '1') initPos --; the last edge is irrelevant
				//else initPos ++;
				break;
			case 1: //1,5,6,9 - > 2^10, 2^6, 2^5, 2^2 	not too hard to figure out the assignment of which n of 2^n
			case 3:
				if (strInitPos.charAt(0) == '1') initPos -= 1024;
				else initPos += 1024;
				if (strInitPos.charAt(4) == '1') initPos -= 64;
				else initPos += 64;
				if (strInitPos.charAt(5) == '1') initPos -= 32;
				else initPos += 32;
				if (strInitPos.charAt(8) == '1') initPos -= 4;
				else initPos += 4;
				break;
		}
		
		return initPos; //return the decimal, so we don't have to convert.
	}
	
	
	public void genEdgeOrientationTable(){//simply goes through all the table and fills it in
		
		for (int i = 0; i < 4; i++){
			//i represents the turn
			
			for (int j = 0; j < 2047; j++){			
				eOrientTable[i][j] = binEOTurn(j, i);
			}
			
		}
	}
	public EdgeOrientationTable(){
		
	};
}
